/**
 * Package:com.afteryuan.server.support;
 * $Id: Point.java,v 1.9 2009/04/27 02:15:40 yangc Exp $
 * Copyright(c) 2001-2005 www.afteryuan.com
 */
package com.afteryuan.server.support;

import java.io.Serializable;

/**
 * Point类 位置类
 * 表示地图上的某个坐标
 * <p/>
 * <p><a href="Point.java.html"><i>View Source</i></a></p>
 *
 * @author <a href="mailto:afteryuan@afteryuan.com">$Author: yangc $</a>
 * @version $Revision: 1.9 $
 */
public class Point implements Serializable{
    /**
     * 构造器，需提供x和y坐标
     * @param x x坐标
     * @param y y坐标
     */
    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    /**
     * 默认构造器
     */
    public Point() {
    }

    /**
     * x坐标
     */
    public int x;
    /**
     * y坐标
     */
    public int y;
    /**
     *
     */
    public int type;
    /**
     *
     */
    public int value;

    /**
     * 该点的深度值
     */
    public int depth;

    /**
     * to string method
     *
     * @return String
     */
    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer();
        sb.append("Point");
        sb.append("{depth=").append(depth);
        sb.append(", x=").append(x);
        sb.append(", y=").append(y);
        sb.append(", type=").append(type);
        sb.append(", value=").append(value);
        sb.append('}');
        return sb.toString();
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Point point = (Point) o;

        return x == point.x && y == point.y;

    }

    public int hashCode() {
        int result;
        result = x;
        result = 31 * result + y;
        return result;
    }
}
